package net.jielan188.hd.util.common.random;

import net.jielan188.hd.util.Log;
import org.apache.commons.lang.RandomStringUtils;

/**
 * 获取随机数
 *@author huangguogang
 *@date 2017-01-23
 */

public class RandomNumberUtil {

  /**
   * 获取随机生成的随机数（count 需要获取随机数的位数）
  */
  public static String getRandomNumber( Integer count ){

    if( count < 1 ){
      Log.info( "getRandomNumber--> get random number count's value less than 1" );
      return null;
    }
     String randomNum = "";
    String temp = "abcvdefghijkmnpqrstuvwxyzQWERTYUIOPASDFGHJKLZXCVBNM1234567890";
    if( count.intValue() < 13 ){
      randomNum = RandomStringUtils.random( count,temp );
    }else{
      //返回当前系统时间参数+随机数
      randomNum = System.currentTimeMillis() + RandomStringUtils.random( ( count - 13 ),temp );
    }
    return randomNum;

  }}